VT-d: fix suspected data race condition in iommu_set_root_entry()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 8 Oct 2013 09:06:48 +0000 (11:06 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 8 Oct 2013 09:06:48 +0000 (11:06 +0200)
commit1c240f1bfed56a459a9cde5100b12bfca4275f26
tree6bbda017b86bd83fd346cf5b05cda57f2c4b5f99
parent84f04d8f0dbfc24a48ee888011ca7410b7bbafc5
VT-d: fix suspected data race condition in iommu_set_root_entry()

Coverity ID: 1054967

Coverity spotted that iommu->root_maddr was optionally allocated within the
protection of the iommu->lock, but was referenced with the protection of the
iommu->register_lock, and freed without any lock.

Luckily, the code as-is is not vulnerable to the potential risks identified.

However, the alloc_pgtable_maddr() is far more appropriately done in
iommu_alloc(), removing a set of spinlock calls, and a possibility for the
iommu setup to fail later than iommu_alloc() with an -ENOMEM.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Xiantao Zhang <xiantao.zhang@intel.com>
xen/drivers/passthrough/vtd/iommu.c